<?php
/**
 * Pipahr
 * @brief An action to delete a notify tpl
 *
 * @author Randy Zhao
 * @copyright 2013 pipahr.com
 */
OCP\JSON::checkAppEnabled('calendar');

if( !OC_User::isLoggedIn() ) {
   jexit(jsonError('您需要先登录', null, false));
}
if (!PSession::checkToken('post')) {
   jexit(jsonError('验证已失效，请重新验证', null, false));
}

$del_id = JRequest::getInt('del_id', 0);
$tpl_type = JRequest::getString('tpl_type', '');

$tpl_model = new PCalendarModelTpl();

if ( !$tpl_model->deleteNotifyTpl($del_id, $tpl_type) ) {
   jexit(jsonError($tpl_model->getError(), null, false));
}

jexit(jsonSuccess('删除成功', null, null, false));